package clientresponse;

import java.io.IOException;

public class ResponseLogin extends ResponseFromServer {
    private short status = -1,gender;
    private int uid;
    private String username,lastname;

    @Override
    public void process() {
        try {
            //inFromServer.readByte();
            status = (short)inFromServer.readByte();
            System.out.println("The status is: "+status);
            inFromServer.readByte();
            uid = (int)inFromServer.readByte();
            System.out.println("The uid is: "+uid);
            inFromServer.readByte();
            inFromServer.readByte();
            inFromServer.readByte();
            int length = (int)inFromServer.readByte();
            inFromServer.readByte();
            byte[]b = new byte[length];
            inFromServer.read(b,0,length);
            username = new String(b,0,length);
            System.out.println("The user is: "+username);
            length = (int)inFromServer.readByte();
            inFromServer.readByte();
            b = new byte[length];
            inFromServer.read(b,0,length);
            lastname = new String(b,0,length);
            System.out.println("The user's lastname is: "+lastname);
            gender = (short)inFromServer.readByte();
            System.out.println("The gender is: "+gender);
            inFromServer.readByte();


        } catch (IOException ex) {
            System.out.println("IO Exception in class ResponseLogin in method process()");
        }

    }

}
